package com.jcsz.gulimall.product.web;

import com.jcsz.gulimall.product.service.SkuInfoService;
import com.jcsz.gulimall.product.vo.SkuItemVo2;
import com.jcsz.gulimall.product.vo.SkuItemVo3;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * @className: ItemController
 * @author: 一把Po吉他
 * @date: 2022/11/6 16:43
 * @version: 1.0
 **/
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public String showDetail(@PathVariable Long skuId, Model model) throws ExecutionException, InterruptedException {
        SkuItemVo3 skuItemVo3 = skuInfoService.getSkuDeatilBySkuId3(skuId);
        model.addAttribute("item", skuItemVo3);
        return "item";
    }
}
